home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
Q-R
/
R⁄O strsml.cpt
/
Ratcliff_Obershelp
/
gestalt.c
next >
Wrap
C/C++ Source or Header
|
1989-01-12
|
1KB
|
47 lines
#include <stdio.h>
#include <strings.h>
/*
GESTALT.C - written by John W. Ratcliff and David E. Metzener November 10, 1987.
Demonstrates the Ratcliff/Obershelp Pattern Recognition Algorithm. Link with
the Function simil(str1, str2).
(DDJ, July 1988, #141, pg.46-51, 68-72).
*/
int simil(char *str1, char *str2);
void ucase(char *str);
main()
{
char str1[80], str2[80];
int prcnt;
printf("This program demonstrates the Ratcliff/Obershelp pattern\n");
printf("\trecognition algorithm. Enter a series of word pairs to\n");
printf("\tdiscover their similarity values.\n\n");
printf("Enter strings of 'END' and 'END' to exit.\n\n");
do
{
printf("Enter two strings seperated by a space: ");
scanf("%s %s", str1, str2);
ucase(str1);
ucase(str2);
prcnt = simil(str1, str2);
printf("%s and %s are %d percent alike.\n\n", str1, str2, prcnt);
}
while (strcmp(str1, "END"));
}
/*
ucase(str) - converts the string to upper case.
*/
void ucase(str)
char *str;
{
while (*str)
{
*str = toupper(*str);
str++;
}
}